<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浮动</title>
    <style>
        .father{
            background-color: aquamarine;
            height: 150px;
            border: 3px solid brown;
            overflow: hidden;
        }
        /* 伪元素清除浮动 */
        /* .father::after{
            content: "";
            display: table;
            clear: both;
        } */
        .left-son{
            width: 100px;
            height: 100px;
            background-color: yellowgreen;
            float: left;
        }
        .right-son{
            width: 100px;
            height: 100px;
            background-color: chartreuse;
            float:right
        }
    </style>
</head>
<body>
    <div class="father">
    <div class="left-son"></div>
    <div class="right-son"></div>
    </div>
</body>
</html>